home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
How Would You Survive?
/
How Would You Survive (1995)(Grolier)[Mac-PC].iso
/
pc
/
shared.dir
/
01988_Script_ChipClass
< prev
next >
Wrap
Text File
|
1995-09-13
|
4KB
|
148 lines
global oGame, oGameControl
property iChipstate, iCastList, iChipNum -- unavailable, TOC or unturned
property iSpriteNum, iCursor, iCurrentBase, iMySound, iBeenClicked, iWrongAnswer
--CHIPSTATES: 1=Inactive, 2=Unturned, 3=IN TOC
on birth me, pSpriteNum, pChipNum, pTOCLet
-- castlist
set vBaseChip=the number of cast "tile icon"
set iCastList=[#inactive:vBaseChip+3, #Unturned:vBaseChip, #TOC:(the number of cast ("TOC."&pTOCLet))]
set iChipNum=pChipNum
set iSpriteNum=pSpriteNum
set iChipState=2
set icursor="HANDCURSOR"
set iMyRollSound=""
set iBeenClicked=0
set iWrongAnswer=0
puppetsprite iSpriteNum, true
return me
end birth
on mRedefineChipCast me, pTocLet
set vBaseChip=the number of cast "tile icon"
--put the number of cast ("TOC."&pTocLet)
set iCastList=[#inactive:vBaseChip+3, #Unturned:vBaseChip, #TOC:(the number of cast ("TOC."&pTocLet))]
end mRedefineChipCast
on mSetWrongAnswer me, pAnswer
set iWrongAnswer=pAnswer
end mSetWrongAnswer
on mGetWrongAnswer me
return iWrongAnswer
end mGetWrongAnswer
on mResetChip me
set iChipState=2
set the castnum of sprite iSpriteNum=getat(iCastList,iChipState)
updatestage
end mResetChip
on mKillChip me
set iChipState=1
set the castnum of sprite iSpriteNum=getat(iCastList,iChipState)
updatestage
if the puppet of sprite iSpriteNum then puppetsprite iSpriteNum, 0
end mKillChip
on mUnPuppetChip me
if the puppet of sprite iSpriteNum then puppetsprite iSpriteNum, 0
end mUnPuppetChip
on mChipClicked me
if iChipState=2 then
mShowQuestion(oGame, iChipNum)
else
if iChipState=3 then
if mGetLevel(oGame)=4 then
set iChipState=1
-- in other words chip goes to inactive state on return and
-- game does not return w/ question open as it would in levels 1-3
else
mSetSuspended(oGame, iChipNum)
end if
if not(the shiftdown) then --APN 7/19
mLeaveToToc(oGameControl, the name of cast(the castnum of sprite iSpriteNum))
else
go frame "Entry"
end if
end if
end if
end mChipClicked
on mUpdateChip me, pIncrement
if pIncrement then
if iChipState>1 then
set iChipState=iChipState+1
if iChipState=4 then set iChipState=1 --(mGetLevel(oGame)=4) or
end if
end if
if not(the puppet of sprite iSpriteNum) then puppetsprite iSpriteNum, true
set the castnum of sprite iSpriteNum=getat(iCastList, iChipState)
updatestage
end mUpdateChip
on hilight me
set pbeenClicked to False
if iChipState<>1 then
if mFullLivesOpen(oGame) or iChipState=3 then
repeat while (rollover(iSpriteNum))
do iCursor
puppettransition 0
-- set the trace = true
-- if pRolloverFunction = "" then
-- nothing
-- else
-- do pRolloverFunction
-- end if
-- set the trace = false
if (the castNum of sprite iSpriteNum = getat(iCastList, iChipState)) then
set the castNum of sprite iSpriteNum = (getat(iCastList, iChipState))+1
if (iMySound) then puppetSound iMySound
set pbeenClicked to False
Updatestage
else
if (the mouseDown) then
set the castNum of sprite iSpritenum = (getat(iCastList, iChipState))+2
set pbeenClicked to TRUE
Updatestage
else
-- the mouse is up
if (pbeenClicked = true and rollover(iSpriteNum)) then
mresethilight me
Updatestage
mChipClicked me
return TRUE
abort
end if
end if
end if
end repeat
mresethilight me
end if
end if
return FALSE
end
on mresethilight me
set the castNum of sprite iSpriteNum = (getat(iCastList, iChipState))
updatestage
end mresethilight
on mGetChipState me
return iChipState
end mGetChipState
on mSetChipState me, pState
set iChipState=pState
end mSetChipState